﻿using Domain.Config;
using Domain.IRepositorys;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Application.App
{
    public class OtherApplication
    {
        public IBannerRepository bannerRepository { get; set; }

        public List<BannerAggregate> GetBannerList(int category)
        {
            DateTime date = DateTime.Now;
            return bannerRepository.Entities.Where(a => (int)a.Category == category && a.StartTime <= date && a.EndTime >= date && a.Enable == true && a.IsDelete == false).OrderBy(a=>a.Sort).ToList();
        }

        public Dictionary<string, int> GetNewRewardInfo()
        {
            Dictionary<string, int> map = new Dictionary<string, int>();

            map.Add($"完成{SystemConfig.GetConfigByTime<int>("系统配置", "新手任务配置.1级任务数", TimeSpan.FromDays(1))}个任务",
                SystemConfig.GetConfigByTime<int>("系统配置", "新手任务配置.1级奖励", TimeSpan.FromDays(1)));
            map.Add($"完成{SystemConfig.GetConfigByTime<int>("系统配置", "新手任务配置.2级任务数", TimeSpan.FromDays(1))}个任务",
                SystemConfig.GetConfigByTime<int>("系统配置", "新手任务配置.2级奖励", TimeSpan.FromDays(1)));
            map.Add($"完成{SystemConfig.GetConfigByTime<int>("系统配置", "新手任务配置.3级任务数", TimeSpan.FromDays(1))}个任务",
                SystemConfig.GetConfigByTime<int>("系统配置", "新手任务配置.3级奖励", TimeSpan.FromDays(1)));

            return map;
        }
    }
}
